Xbasic

time_gmt_to_local Function

Syntax

dim result as T = time_gmt_to_local(T timeVal [,N offset])

Arguments

timeValTime

GTM time value to convert.

offsetNumeric

The number of minutes that local time is after/before GMT. E.g. if the local time zone is GMT-4, the offset would be -4 * 60 or -240.

Returns

resultTime

Returns the GMT time converted to local time.

Description

Converts GMT time to local time.

Discussion

The time_gmt_to_local() function converts a time value in GMT to local time. The local time is determined by the offset.

In a web application that makes Ajax callbacks, the request automatically includes the offset value for the client. If this function is called in server-side code as part of an Ajax callback, it is not necessary to pass in a value for the offset.

Example

dim offset as N = getTimeZoneOffset()

? offset
= -4

? time_gmt_to_local(now(), offset * 60)
= 09/18/2020 11:14:23 40 am

See Also